package com.wang.exception_homework.hw2;

import java.util.Scanner;

public class Demo {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入课程代号(1~3之间的数字):");
        try {
            int choice = sc.nextInt();
            switch (choice){
                case 1:
                    System.out.println("C#编程");
                    break;
                case 2:
                    System.out.println("Java编程");
                    break;
                case 3:
                    System.out.println("PHP编程");
                    break;
                default:
                    throw new Exception("输入错误，请输入1~3之间的数字！");
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
        } finally {
            System.out.println("欢迎提出建议！");
        }
    }
}
